package com.spring.arch.common.security;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import static com.spring.arch.common.security.SecurityProperties.SECURITY_PREFIX;

/**
 * 安全认证相关属性
 *
 * @author Frank
 */
@Data
@ConfigurationProperties(SECURITY_PREFIX)
public class SecurityProperties {

    public final static String SECURITY_PREFIX = "app";

    /**
     * 是否开启鉴权默认开启
     */
    private boolean enable = true;

    private Auth auth = new Auth();

    /**
     * 排除鉴权Url（支持Ant风格）
     */
    private String excludeAuthUrl;

    @Data
    public static class Auth {

        private String resourceId = "all";
        private String signingKey = "JWTSuperSecretKey@PhotoSaver";

        /**
         * 默认的token过期时长2小时（单位秒）
         */
        private Integer defaultAccessTokenTimeout = 2 * 3600;

        /**
         * 默认的刷新token过期时长2小时（单位秒）
         */
        private Integer defaultRefreshTokenTimeout = 2 * 3600;
    }
}